/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author LYS
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { CqBasicModel, Page } from '../../model/baseModel';
import { QueslibPlan } from '../plan/queslibPlan';
import { QueslibRes } from '../res/queslibRes';

const { adminPath } = useGlobSetting();

export interface QueslibInfo extends CqBasicModel<QueslibInfo> {
  ctitle?: string; // 标题
  ccontent?: string; // 内容
  manager?: string; // 责任人
  ctype?: string; // 类型
  milestone?: string; // 里程碑
  beginDate?: string; // 开始时间
  endDate?: string; // 截止时间
  topLevel?: string; // 置顶等级
  firstLevel?: string; // 优先级
  step?: string; // 问题阶段
  cresult?: string; // 处理结果
  createDate?: string; // 创建时间
  updateDate?: string; // 更新时间
  plan: QueslibPlan; // 最新方案
  res: QueslibRes; // 最新结果
}

export const queslibInfoList = (params?: QueslibInfo | any) =>
  defHttp.get<QueslibInfo>({ url: adminPath + '/queslib/info/queslibInfo/list', params });

export const queslibInfoListData = (params?: QueslibInfo | any) =>
  defHttp.post<Page<QueslibInfo>>({
    url: adminPath + '/queslib/info/queslibInfo/listData',
    params,
  });

export const queslibInfoForm = (params?: QueslibInfo | any) =>
  defHttp.get<QueslibInfo>({ url: adminPath + '/queslib/info/queslibInfo/form', params });

export const queslibInfoSave = (params?: any, data?: QueslibInfo | any) =>
  defHttp.postJson<QueslibInfo>({
    url: adminPath + '/queslib/info/queslibInfo/save',
    params,
    data,
  });

export const queslibInfoFieldSave = (params?: any, data?: QueslibInfo | any) =>
  defHttp.postJson<QueslibInfo>({
    url: adminPath + '/queslib/info/queslibInfo/saveField',
    params,
    data,
  });

export const saveContent = (params?: any, data?: QueslibInfo | any) =>
  defHttp.postJson<QueslibInfo>({
    url: adminPath + '/queslib/info/queslibInfo/saveContent',
    params,
    data,
  });

export const queslibInfoDelete = (params?: QueslibInfo | any) =>
  defHttp.get<QueslibInfo>({ url: adminPath + '/queslib/info/queslibInfo/delete', params });

export const queslibInfoUpdateStep = (params?: QueslibInfo | any) =>
  defHttp.get<QueslibInfo>({
    url: adminPath + '/queslib/info/queslibInfo/quesOpenOrClose',
    params,
  });
